<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <p>
        <input type="text" oninput="">
    </p>
    <p style="height: 16px; background: #f00; color: #fff;" id="info0"></p>
    <p style="height: 16px; background: #f00; color: #fff;" id="info1"></p>
    <p style="height: 16px; background: #f00; color: #fff;" id="info2"></p>
    <p style="height: 16px; background: #f00; color: #fff;" id="info3"></p>
    <script>
        var obj = {
            info0: 10,
            info1: 101,
            obj : {
                info2: 1001,
                info3: 1
            }
        };
        function Observer(data) {
            for(var name in data){
                if(typeof data[name] === 'object'){
                    Observer(data[name])
                } else {
                    addBindData(data,name,data[name])
                }
            }
        }
        Observer(obj)

        function addBindData(obj,prop,initVal){
            console.log(obj,prop,initVal)
            Object.defineProperty(obj, prop, {
                set: function(val) {
                    document.getElementById(prop).innerText = val
                },
                get: function() {
                    console.log('getter function has been triggered')
                    return obj.info;
                }
            });
            obj[prop] = initVal;
        }
    </script>
</body>
</html>